package com.sky.controller.user;

import com.sky.result.Result;
import com.sky.service.SetmealService;
import com.sky.vo.SetmealVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("WxSetmeal")
@RequestMapping("/user/setmeal")
public class SetmealController {
    @Autowired
    SetmealService setmealService;
    @GetMapping("/list")
    @CachePut(cacheNames = "SETMEAL_",key = "#categoryId")
    public Result<List<SetmealVO>> querySetMealByCategoryId(@RequestParam Long categoryId){
        List<SetmealVO> list =  setmealService.querySetMealByCategoryId(categoryId);
        return Result.success(list);
    }
}
